<template>
    <div>
      <el-table :data="majors" style="width: 100%">
        <el-table-column prop="MajorID" label="专业ID" width="180"></el-table-column>
        <el-table-column prop="MajorName" label="专业名称"></el-table-column>
        <el-table-column prop="CollegeID" label="学院ID"></el-table-column>
      </el-table>
    </div>
  </template>
  
  <script>
  import axios from 'axios';
  
  export default {
    data() {
      return {
        majors: []
      };
    },
    mounted() {
      this.fetchMajors();
    },
    methods: {
      async fetchMajors() {
        const response = await axios.get('/api/majors');
        this.majors = response.data;
      }
    }
  };
  </script>
  
  <style>
  </style>
  